package operation;

import staff.Staff;
import staff.StaffList;
import java.util.Scanner;
public class FindOperation implements IOperation{
    @Override
    public Staff work(StaffList staffList) {
        System.out.println("员工基本信息查询");
        System.out.println("输入要查找的姓名");
        Scanner sc = new Scanner(System.in);
        String staff_name = sc.nextLine();
        int size = staffList.getUsedSize();
        for (int i = 0; i < size; i++) {
            Staff staff = staffList.getStaffs(i);
            if(staff.getStaff_name().equals(staff_name)){
                System.out.println("已找到该员工！");
                System.out.println(staff);
                return staff;
            }
        }
        System.out.println("无此员工！");
        return null;
    }
}
